Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Implement Pest Detection Using Custom YOLOv8n Model #216

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

rohan-uiuc
Copy link
Contributor

This pull request introduces a comprehensive pest detection feature, aimed at enhancing agricultural analysis capabilities. The feature is built around a custom-trained YOLOv8n model, specifically designed for high accuracy in pest detection and classification by @adityasngpta

Key Components Introduced:

  • PestDetection class: A core component that loads the YOLOv8n model and performs pest detection on given images, returning annotated images with bounding boxes and class labels.
  • /pest-detection endpoint: A new API endpoint that accepts image URLs for pest detection, processes them through the PestDetection class, and returns annotated images.
  • Integration with Ingest class: The pest detection feature is seamlessly integrated into the existing Ingest class, allowing for easy invocation of pest detection alongside other functionalities like uploading annotated images to AWS S3

Technical Details:

  • The YOLOv8n model is loaded from a specified path, with weights obtained from a dedicated Dropbox link.
  • The pest detection process involves running inference on the provided images and extracting annotated images with detailed pest information.
  • Annotated images are temporarily stored and uploaded to an S3 bucket, with URLs returned to the requester.

Usage:
This feature can be accessed via the /pest-detection endpoint, expecting a JSON payload with an image_urls key. It supports processing multiple images in a single request, enhancing efficiency and usability for end-users.

Future Directions:
While this implementation marks a significant advancement in our backend's capabilities, future work will focus on optimizing model performance, expanding the range of detectable pests, and improving the user experience with more detailed annotations.

This feature is expected to significantly contribute to the agricultural sector by providing advanced tools for pest detection and management, ultimately leading to better crop health and yield.

rohan-uiuc and others added 22 commits February 9, 2024 00:14
This introduces a new pest detection feature, leveraging a custom-trained YOLOv8n model. It includes the PestDetection class for processing images, an endpoint for handling pest detection requests, and integration with the Ingest class for running pest detection on images and uploading annotated images to S3.
@KastanDay
Copy link
Member

Could try using the Ultralytics container directly: https://hub.docker.com/r/ultralytics/ultralytics

@KastanDay
Copy link
Member

Super small!
docker pull ultralytics/ultralytics:latest-cpu

@KastanDay
Copy link
Member

With minified image ultralytics/ultralytics:latest-cpu:
CleanShot 2024-02-16 at 13 29 24

With previous non-optimized image:
CleanShot 2024-02-16 at 13 29 59

I think the old version has better cold start times (which should be the only difference).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants